﻿<phone:PhoneApplicationPage 
    x:Class="ThuPhap.ChooseImage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    mc:Ignorable="d" d:DesignHeight="728" d:DesignWidth="480"
    toolkit:TiltEffect.IsTiltEnabled="True"
    shell:SystemTray.IsVisible="False">

    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>
    <!--LayoutRoot is the root grid where all page content is placed-->
    <phone:PhoneApplicationPage.Resources>
        <Style x:Key="FillBrush" TargetType="Rectangle">
            <Setter Property="Fill" Value="Black"/>
            <Setter Property="Opacity" Value="0.5"/>
            <Setter Property="Stretch" Value="Fill"/>
        </Style>
    </phone:PhoneApplicationPage.Resources>
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        
        <!--TitlePanel contains the name of the application and page title-->
        <!--<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="EDIT IMAGE" Style="{StaticResource PhoneTextNormalStyle}"/>
        </StackPanel>-->

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <Grid Name="ImageView" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Visible">
                <!--<Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="auto"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                </Grid.RowDefinitions>-->
                <Image 
                    x:Name="ImgZoom"
               Stretch="Uniform"
               RenderTransformOrigin="0,0">
                    <toolkit:GestureService.GestureListener>
                        <toolkit:GestureListener
                        PinchStarted="OnPinchStarted"
                        PinchDelta="OnPinchDelta"
                        DragDelta="OnDragDelta"
                        DoubleTap="OnDoubleTap"/>
                    </toolkit:GestureService.GestureListener>
                    <Image.RenderTransform>
                        <CompositeTransform
                        ScaleX="1" ScaleY="1"
                        TranslateX="0" TranslateY="0"/>
                    </Image.RenderTransform>
                </Image>
            </Grid>
        </Grid>
        <Grid Grid.RowSpan="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Rectangle Grid.Column="0" Grid.Row="0" Stretch="Fill" Grid.ColumnSpan="3" Style="{StaticResource FillBrush}"></Rectangle>
            <Rectangle Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="3" Style="{StaticResource FillBrush}"></Rectangle>
            <Rectangle Grid.Column="0" Grid.Row="1" Style="{StaticResource FillBrush}"></Rectangle>
            <Rectangle Grid.Column="2" Grid.Row="1" Style="{StaticResource FillBrush}"></Rectangle>
            <Rectangle Name="ViewAreaRectangle" Stroke="White" StrokeThickness="2" Grid.Column="1" Grid.Row="1" Stretch="Fill"></Rectangle>
        </Grid>
    </Grid>
 
    <!--Sample code showing usage of ApplicationBar-->
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar  IsVisible="True" IsMenuEnabled="True" BackgroundColor="{StaticResource PhoneAccentColor}">
            <shell:ApplicationBarIconButton IconUri="/Resources/Images/appbar.check.rest.png" Text="crop" Click="OkApplicationBarIconButton_Click"/>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

</phone:PhoneApplicationPage>
